<#assign pageName="示例数据管理">
<@override name="page-content">
<form class="layui-form form-horizontal" role="form" method="post">
    <div class="layui-form-search panel">
        <@ctrl.TextboxQuery path="exampleInfo.name" labelText="名称"/>
        <div class="margin-5">
            <a href="javascript:;" onclick="$('form:first').submit();" class="layui-btn layui-btn-sm">
                <i class="layui-icon layui-icon-search"></i>查询
            </a>
            <a href="javascript:;" class="layui-btn layui-btn-warm layui-btn-sm js-reset">
               <i class="layui-icon layui-icon-refresh-1"></i>重置
            </a>
            <a href="add" class="layui-btn layui-btn-normal layui-btn-sm js-add">
                <i class="layui-icon layui-icon-add-1"></i>新增
            </a>
        </div>
    </div>
    <table class="layui-table">
        <thead>
            <tr>
                <th class="align-center" width="50px" nowrap="nowrap">序号</th>
                <th class="align-center" nowrap="nowrap" width="100px">名称</th>
                <th class="align-center" nowrap="nowrap" width="100px">性别</th>
                <th class="align-center" nowrap="nowrap" width="100px">生日</th>
                <th class="align-center layui-hide-xs">爱好</th>
                <th class="align-center layui-hide-xs">个性签名</th>
                <th class="align-center" width="100px">操作</th>
            </tr>
        </thead>
        <tbody>
            <#if (queryResult.rows)?has_content>
                <#list queryResult.rows as dataItem>  
                <tr>
                    <td class="align-center" width="50px" nowrap="nowrap">
                        ${(pageNo-1)*pageSize+dataItem_index+1}
                    </td>
                    <td class="align-center" nowrap="nowrap">
                       ${dataItem.name}
                    </td>
                    <td class="align-center"  nowrap="nowrap">
                        ${dataItem.sex}
                    </td>
                    <td class="align-center"  nowrap="nowrap">
                        <#if dataItem.birthday?has_content>
                        ${dataItem.birthday?date}
                        </#if>
                    </td>
                    <td class="layui-hide-xs">
                        <#assign hobbys={"1":"唱歌","2":"跳舞","3":"画画"}>
                        <#list hobbys?keys as key>
                            <#if dataItem.hobby?contains(key)>
                             <span>${hobbys[key]}、</span>
                            </#if>
                        </#list>
                    </td>
                    <td class="layui-hide-xs">
                        <span>${dataItem.signature}</span>
                    </td>
                    <td class="align-center">
                        <div class="layui-table-cell">
                             <a class="layui-btn layui-btn-warm layui-btn-xs" href="edit/${dataItem.id}">
                                <i class="layui-icon layui-icon-edit"></i>编辑
                             </a> 
                             <button type="button" class="layui-btn layui-btn-danger layui-btn-xs"
                                onclick="confirmSubmit('确定要删除数据‘${dataItem.name}’吗？', {id:'${dataItem.id}', name:'${dataItem.name}'},'del')">
                                <i class="layui-icon layui-icon-delete"></i>删除
                            </button>
                        </div>
                    </td>
                </tr>
                </#list>
            <#else>
                <tr>
                    <td colspan="7" style="color:red;text-align:center;font-weight:bold;">暂无符合条件的示例信息</td>
                </tr>
            </#if>
            </tbody>
        </table>
        <@ctrl.pageShow (queryResult.total)!0, (queryResult.pageIndex)!0 />
    </form>
</@override>
<@override name="page-scripts">
     <script>
        $(function(){
            layui.use(['form','layer', 'jquery'], function(){
                var form=layui.form;
                var layer=layui.layer;
                var $ = layui.jquery;
                $('.js-reset').on('click', function(){
                    $('#pageNo').val(1);
                    $('#name').val("");
                    $('form:first').submit();
                })
            })
        })
    </script>
</@override>
<@extends name="/layout/basepage.html"/> 